<?php

namespace app\models;

use Yii;
use yii\db\Query;
/**
 * This is the model class for table "gky_we_guest_prof".
 *
 * @property integer $id
 * @property integer $num
 * @property string $name
 * @property string $sex
 * @property string $birth
 * @property string $work_organization
 * @property string $organization_type
 * @property string $job
 * @property string $edu_bg
 * @property string $degree
 * @property string $res_dir
 * @property string $hire_time
 * @property string $hire_organization
 * @property string $agree_time
 * @property string $agree_man
 * @property string $contact_way
 * @property string $remarks
 */
class GkyWeGuestProf extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'gky_we_guest_prof';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['num', 'name', 'sex'], 'required'],
            [['num'], 'integer'],
            [['birth', 'agree_time'], 'safe'],
            [['name', 'work_organization', 'res_dir', 'hire_time', 'hire_organization', 'remarks'], 'string', 'max' => 255],
            [['sex'], 'string', 'max' => 2],
            [['organization_type', 'job', 'edu_bg', 'degree', 'agree_man', 'contact_way'], 'string', 'max' => 50],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'num' => 'Num',
            'name' => 'Name',
            'sex' => 'Sex',
            'birth' => 'Birth',
            'work_organization' => 'Work Organization',
            'organization_type' => 'Organization Type',
            'job' => 'Job',
            'edu_bg' => 'Edu Bg',
            'degree' => 'Degree',
            'res_dir' => 'Res Dir',
            'hire_time' => 'Hire Time',
            'hire_organization' => 'Hire Organization',
            'agree_time' => 'Agree Time',
            'agree_man' => 'Agree Man',
            'contact_way' => 'Contact Way',
            'remarks' => 'Remarks',
        ];
    }
    
    public static function getProfessor($pageNow, $pageSize){
        return (new Query())
                ->select("*")
                ->from('gky_we_guest_prof')
                ->limit($pageSize)
                ->offset(($pageNow - 1) * $pageSize)
                ->all();
    }
}
